Page({
    data: {
        allDistrictList: [],
        cityList: [],
        cityIndex: 0,
        districtList: [],
        districtIndex: 0,
        loading: true,
        btnDis: true
    },
    createStep2: function createStep2(e) {
        wx.navigateTo({
            url: '../createStep2/createStep2?params=' + JSON.stringify(e.detail.value)
        });
    },
    addCity: function addCity(e) {
        this.setData({
            cityIndex: e.detail.value,
            districtList: this.data.allDistrictList[e.detail.value]
        });
    },
    addDistrict: function addDistrict(e) {
        this.setData({
            districtIndex: e.detail.value
        });
    },
    onLoad: function onLoad(options) {
        var _this = this;
        wx.request({
            url: 'http://localhost:8080/wxAppletOpportunity/getCityAndDistrict',
            data: {},
            method: 'POST',
            header: {
                'content-type': 'application/json'
            },
            success: function success(res) {
                _this.setData({
                    cityList: res.data.cityList,
                    allDistrictList: res.data.districtList,
                    districtList: res.data.districtList[0],
                    loading: false,
                    btnDis: false
                });
            }
        });
    }
});